//
//  BDTextLabel.m
//  BadBoy
//
//  Created by wen on 2017/5/5.
//  Copyright © 2017年 com.8xiong. All rights reserved.
//

#import "BDTextLabel.h"
#import "YYImage.h"

@implementation BDTextLabel

- (instancetype)init{
    if (self = [super init]) {
        NSMutableDictionary *mapper = [NSMutableDictionary dictionary];
        NSDictionary *emoDic = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"LiuqsEmotions" ofType:@"plist"]];
        for (NSString *key in emoDic.allKeys) {
            
            YYImage *image = [YYImage imageNamed:[NSString stringWithFormat:@"%@.png", emoDic[key]]];
            image.preloadAllAnimatedImageFrames = YES;
            [mapper setObject:image forKey:key];
        }
        
        YYTextSimpleEmoticonParser *parser = [YYTextSimpleEmoticonParser new];
        parser.emoticonMapper = mapper;
        
        YYTextLinePositionSimpleModifier *mod = [YYTextLinePositionSimpleModifier new];
        mod.fixedLineHeight = 22;
        
        self.textParser = parser;
        self.displaysAsynchronously = YES;
    }
    return self;
}

@end
